﻿Type=Activity
Version=6
ModulesStructureVersion=1
B4A=true
@EndOfDesignText@
#Region  Activity Attributes 
	#FullScreen: False
	#IncludeTitle: True
#End Region
#Extends: android.support.v7.app.ActionBarActivity
Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.

End Sub

Sub Globals
	'These global variables will be redeclared each time the activity is created.
	'These variables can only be accessed from this module.

	Private lbltitle As Label
	Private btnsubmit As Label
	Private clvmyinfos As clsCustomListView
	Private itemname As Label
	Private itemvalue As Label
	Private ivrightarr As ImageView
	Private mi As myInfo=Null
	Private cscls As customerserviceCLS
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim telaw As telanywhere
telaw.Initialize(Activity)

	'Do not forget to load the layout file created with the visual designer. For example:
	Activity.LoadLayout("laymodifymyinfo")
	initviews
End Sub
Private Sub initviews
	lbltitle.Text="设置"
	btnsubmit.Text=""
	cscls.Initialize(Activity)
	Dim nw As Int=100%x,nh As Int=53dip
	clvmyinfos.dividerHeight=1dip
	clvmyinfos.Add(CreateItemCommon("用户协议","",nw,nh,True),nh,0)
	clvmyinfos.Add(CreateItemCommon("关于我们","",nw,nh,True),nh,1)
	clvmyinfos.Add(CreateItemCommon("版本升级","Ver"&Application.VersionName,nw,nh,True),nh,2)
	clvmyinfos.Add(CreateItemCommon("联系客服","",nw,nh,True),nh,3)
	clvmyinfos.AddCustomDivider(15dip)
	If comm.isLogin Then
		clvmyinfos.Add(CreateLogoffItem(nw,nh),nh,4)
		mi=g_store.get("myinfo")
	End If
End Sub
Private Sub CreateLogoffItem(w As Int,h As Int) As Panel
	Dim p As Panel
	p.Initialize("")
	Activity.AddView(p,0,0,w,h)
	Dim lbl As Label
	lbl.Initialize("")
	lbl.Text="退出登录"
	lbl.TextColor=comm.N_COLOR_TITLE
	lbl.TextSize=18
	lbl.Color=Colors.White
	lbl.Gravity=Gravity.CENTER
	p.AddView(lbl,0,0,w,h)
	p.RemoveView
	Return p
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Private Sub CreateItemCommon(str As String,val As String,w As Int,h As Int,hasArr As Boolean) As Panel
	Dim p As Panel
	p.Initialize("")
	Activity.AddView(p,0,0,w,h)
	p.LoadLayout("itemmodifymyinfocommon")
	ivrightarr.Visible=hasArr
	p.RemoveView
	itemname.Text=str
	itemvalue.Text=val
	Return p
End Sub
Private Sub setItemVal(p As Panel,val As String)
	Dim lbl As Label
	For Each v As View In p.GetAllViewsRecursive
		Log(v.Tag)
		If "val".EqualsIgnoreCase(v.Tag) Then
			lbl=v
			lbl.Text=val
		End If
	Next
	Return
End Sub

Sub ivback_Click
	Activity.Finish
End Sub

Sub clvmyinfos_ItemClick (Index As Int, Value As Object)
	Select Value
		Case 0'用户协议
			Dim vw As wvUrl
			vw.Initialize
			vw.title="用户协议"
			vw.Url=comm.getApi(-1)&"app/qita/user_xieyi"
			comm.startWV(vw)
		Case 1'关于我们
			Dim vw As wvUrl
			vw.Initialize
			vw.title="关于我们"
			vw.Url=comm.getApi(-1)&"app/qita/article?content_id=65"
			comm.startWV(vw)
		Case 2 '版本升级
			comm.showProgress("正在获取最新版本信息")
			Dim cur As checkupdatereq
			cur.Initialize
			cur.cb=Me
			CallSubDelayed2(Starter,"reqCheckUpdate",cur)
		Case 3'联系客服
			If mi<>Null And mi.kefu.Length>4 Then 
				cscls.callCommonCustomService
			Else
				Dim pi As Intent
				pi.Initialize(pi.ACTION_VIEW,"tel:"&comm.S_CLIENTPHONENUMBER)
				StartActivity(pi)
			End If
			
		Case 4'退出登录
			If Msgbox2("确定要退出登录吗?","退出","确定","取消","",Null)==DialogResponse.POSITIVE Then
				ToastMessageShow("退出登录",False)
				CallSubDelayed(actmain,"CallLogout")
				Activity.Finish
			End If
			
	End Select
End Sub
'更新检测反馈事件（回调）
Sub checkupdateover(tcur As checkupdateres)
	ProgressDialogHide
	If tcur.status=200 Then
		Dim sCurVer As String=Application.VersionName.ToLowerCase.Replace("v","").Replace("ver","")
		If sCurVer.CompareTo(tcur.ver)<>0 Then
			If DialogResponse.POSITIVE=Msgbox2("更新内容:"&tcur.content,"有新版本","更新","取消","",Null) Then
				comm.ShowUrlOutter(tcur.url)
			End If
		Else
			comm.T("已经是最新版本:"&tcur.ver)
			Log("lastVer:"&tcur.ver)
		End If
	Else
		Msgbox("错误信息:"&tcur.content,"检测失败")
	End If
End Sub